{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# FAQ\n",
    "\n",
    "Frequently Asked Questions (FAQ)."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Why evaluate with 641px instead of 640px?\n",
    "\n",
    "OpenPifPaf uses the standard convention of PyTorch models to pad convolutions. \n",
    "Let's start with an example: a single layer of a 3x3 conv with stride 2 that is padded with 1. For an output feature map of size 2x2, the input must be of size 3x3. This generalization holds: the input must be of size `(nx * stride + 1, ny * stride + 1)`.\n",
    "The models that OpenPifPaf uses have an intermediate layer with stride 16. Therefore, good input image sizes are multiples of 16 plus 1. \n",
    "\n",
    "It is usually not a problem if the input size is not perfect. There will just be a small margin on the right side and bottom of the image that is not \"covered\" by a feature map cell."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Predict is slow\n",
    "\n",
    "Check whether your installation of PyTorch can access CUDA for GPU processing.\n",
    "If the output of the command below is False, then PyTorch cannot make use of your GPU and OpenPifPaf falls back to CPU processing."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "!python -c \"import torch; print(torch.cuda.is_available())\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "You can also run `predict` with the `--debug` option. Compare your output with the output in {doc}`predict_cli` to understand which part of the process is slow for you. For a fair comparison, also use `--disable-cuda` because the reference in this documentation is created without CUDA."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3.7.4 64-bit ('venv3': venv)",
   "name": "python37464bitvenv3venve864f70b47a24f709eace0523e013bb0"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.4-final"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
